#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    this->setupUi(this);

    kGraphicsScene = new KGraphicsScene(this);
    this->graphicsView->setScene(this->kGraphicsScene);


    connect(this->pushButton, SIGNAL(clicked()), this, SLOT(setLineTool()));
    connect(this->pushButton_2, SIGNAL(clicked()), this, SLOT(setRectTool()));
    connect(this, SIGNAL(changeCurrentShape(DrawTool)), kGraphicsScene, SLOT(setCurrentShape(DrawTool)));

}

void MainWindow::setLineTool()
{
    emit changeCurrentShape(DrawToolLine);
}

void MainWindow::setRectTool()
{
    emit changeCurrentShape(DrawToolRect);
}


MainWindow::~MainWindow()
{

}

void MainWindow::setupUi(QMainWindow *MainWindow)
{
    if (MainWindow->objectName().isEmpty())
        MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
    MainWindow->resize(511, 425);
    action = new QAction(MainWindow);
    action->setObjectName(QString::fromUtf8("action"));
    action_2 = new QAction(MainWindow);
    action_2->setObjectName(QString::fromUtf8("action_2"));
    centralWidget = new QWidget(MainWindow);
    centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
    treeView = new QTreeView(centralWidget);
    treeView->setObjectName(QString::fromUtf8("treeView"));
    treeView->setGeometry(QRect(10, 40, 91, 211));
    graphicsView = new QGraphicsView(centralWidget);
    graphicsView->setObjectName(QString::fromUtf8("graphicsView"));
    graphicsView->setGeometry(QRect(115, 40, 271, 211));
    pushButton = new QPushButton(centralWidget);
    pushButton->setObjectName(QString::fromUtf8("pushButton"));
    pushButton->setGeometry(QRect(10, 10, 75, 23));
    pushButton_2 = new QPushButton(centralWidget);
    pushButton_2->setObjectName(QString::fromUtf8("pushButton_2"));
    pushButton_2->setGeometry(QRect(90, 10, 75, 23));
    MainWindow->setCentralWidget(centralWidget);
    menuBar = new QMenuBar(MainWindow);
    menuBar->setObjectName(QString::fromUtf8("menuBar"));
    menuBar->setGeometry(QRect(0, 0, 511, 17));
    menu = new QMenu(menuBar);
    menu->setObjectName(QString::fromUtf8("menu"));
    menu_2 = new QMenu(menuBar);
    menu_2->setObjectName(QString::fromUtf8("menu_2"));
    MainWindow->setMenuBar(menuBar);
    mainToolBar = new QToolBar(MainWindow);
    mainToolBar->setObjectName(QString::fromUtf8("mainToolBar"));
    MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar);
    statusBar = new QStatusBar(MainWindow);
    statusBar->setObjectName(QString::fromUtf8("statusBar"));
    MainWindow->setStatusBar(statusBar);

    menuBar->addAction(menu->menuAction());
    menuBar->addAction(menu_2->menuAction());
    menu->addAction(action);
    menu_2->addAction(action_2);
    mainToolBar->addSeparator();

    retranslateUi(MainWindow);

    QMetaObject::connectSlotsByName(MainWindow);
}

void MainWindow::retranslateUi(QMainWindow *MainWindow)
{
    MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8));
    action->setText(QApplication::translate("MainWindow", "\351\200\200\345\207\272", 0, QApplication::UnicodeUTF8));
    action_2->setText(QApplication::translate("MainWindow", "\345\205\263\344\272\216\346\210\221\344\273\254", 0, QApplication::UnicodeUTF8));
    pushButton->setText(QApplication::translate("MainWindow", "\347\224\273\347\272\277", 0, QApplication::UnicodeUTF8));
    pushButton_2->setText(QApplication::translate("MainWindow", "\347\224\273\346\241\206", 0, QApplication::UnicodeUTF8));
    menu->setTitle(QApplication::translate("MainWindow", "\345\267\245\347\250\213", 0, QApplication::UnicodeUTF8));
    menu_2->setTitle(QApplication::translate("MainWindow", "\345\205\263\344\272\216", 0, QApplication::UnicodeUTF8));
}
